<?php

$catid = empty($_GET['catid']) ? 0 : $_GET['catid'];
$id = empty($_GET['id']) ? 0 : intval($_GET['id']);

if($id > 0){
	$oNews = new News();
	$news = $oNews->get_row($id, '*');
	
	$style = explode(',', $news['style']);
	$news['style'] = str_replace(',', ' ', $news['style']);
	@$news['_' . $style[0]] = true;
	@$news['_' . $style[1]] = true;
	$news['publish'] = $news['publish'] > 0 ? 1 : 0;
	if($news['rank'] == 32000){
		$news['ontop'] = 1;
		$news['rank'] = 0;
	}
	$news['addtime'] = ftime($news['addtime'], true);
	$news['updatetime'] = ftime(0, true);

}else{
	$news = array(
		'catid'		=> $catid,
		'publish'	=> 1,
		'rank'		=> 10000,
		'addtime'	=> ftime(0, true),
	);
}

$oNewscat = new Newscat();
$category_tree = $oNewscat->get_category_tree_ul(0, true, $id); // 取分类树
if($news['catid'] > 0){
	$category_info = $oNewscat->get_row($news['catid'], 'id,name');
	$news['category_name'] = $category_info['name'];
}else{
	$news['category_name'] = $__l['root'];
}
$news['category_tree'] = $category_tree;

$vars['info'] = $news;
$vars['updatetime_block'] = true;
?>